home *** CD-ROM | disk | FTP | other *** search
-
- -- Start at low music:
- CurMusicLevel = 0
-
- ---------------------------------------------------------------------------
- -- Generic Level Exit function
- ---------------------------------------------------------------------------
-
- function LevelExitDesc()
- if ( GameState == QuitLevel )then
- G.ActiveBackGround( 2 );
-
- TraitorTalk( "Hey where are you going!?!" )
-
- return "YOU QUIT!";
- elseif( GameState == Victory )then
- G.ActiveBackGround( 1 );
- return "YOU WON!";
- elseif( GameState == Defeat )then
- G.ActiveBackGround( 2 );
-
- TraitorTalk( "Oh no! The base, it's been invaded!" )
-
- return "YOU LOST!";
- end
- end
-
- ---------------------------------------------------------------------------
- -- Generic Level Update function
- ---------------------------------------------------------------------------
-
- -- Not really a victory check, this checks for defeat!
- function CheckLevelCompletion()
- local tower = G.GetCogName("Tower");
-
- if( not tower.IsValid() ) then
- G.SetGameState( Defeat );
- end
-
- if( not( GameState == InLevel ) ) then
- dofile( "Scripts/GameOver.lua" ); -- The gameover script should do all exit functionality:
- GMain["LevelUpdate"] = nil;
- end
- end
-
- function LevelUpdate()
-
- -- Make sure the player isn't trying to exit the level
- CheckLevelCompletion()
- UpdateGameMusic()
- -- This is the intro, where you check for level
- if( levelRoutine ) then
- local con, error = coroutine.resume( levelRoutine )
-
- -- Start the Level Sequence:
- if( con == false and GameState == InLevel ) then
- G.Mes( error )
- levelRoutine = coroutine.create( LevelSequence )
- end
- end
- end
-